import { defineStore } from "pinia";
export const userStore = defineStore("user", {
  state: () => {
    return {
      userInfo: {},
    };
  },
  getters: {},
  actions: {
    setUserInfo(data) {
      this.userInfo = data;
    },
  },
  persist: {
    enabled: true, // 开启数据缓存
    strategies: [
      {
        key: "userInfo",
        storage: localStorage, // 默认是sessionStorage
        paths: ["userInfo"],
      },
    ],
  },
});
